import request from '@/utils/request'
/**
 * 获取知识点得分率数据
 */
function handleResponse(response) {
    if (response.code === 200) {
      return response;
    } else {
      throw new Error(response.message || '请求失败');
    }
  }


  //年级五率
export function gradefiverateDate(subjectId, gradeId, classIds, startTime, endTime) {
  return request({
    url: `/api/score/grade-rates-comparison`,
    method: 'post',
    data: { subjectId, gradeId, classIds, startTime, endTime}
  }).then(handleResponse);
}

//作业提交情况对比
export function homeworksaveDate(subjectId, gradeId, classIds, startTime, endTime) {
    return request({
      url: `/api/score/homework-submit-comparison`,
      method: 'get',
      params: { subjectId, gradeId, classIds, startTime, endTime}
    }).then(handleResponse);
}

//   年级各班级知识点得分率
export function Gradescorerate(subjectId, gradeId, classIds, startTime, endTime) {
    return request({
      url: `/api/score/grade-knowledge-score-rates`,
      method: 'get',
      params: { subjectId, gradeId, classIds, startTime, endTime}
    }).then(handleResponse);
}

//年级各科高频错题
export function GradeHighfrequencyincorrectquestions(subjectId, gradeId, classIds, startTime, endTime) {
    return request({
      url: `/api/score/grade-error-questions`,
      method: 'get',
      params: { subjectId, gradeId, classIds, startTime, endTime}
    }).then(handleResponse);
}

//知识点改进效果折线图与图表
export function knowledgeechartdata(subjectId, gradeId, classIds, startTime, endTime) {
    return request({
      url: `/api/score/grade-knowledge-score-rates/chart`,
      method: 'get',
      params: { subjectId, gradeId, classIds, startTime, endTime}
    }).then(handleResponse);
} 

//作业列表/api/exam/list
export function homeworkDate(subjectId, gradeId, classIds, startTime, endTime) {
  return request({
    url: `/api/exam/list`,
    method: 'get',
    params: { subjectId, gradeId, classIds, startTime, endTime}
  }).then(handleResponse);
} 

//年级成绩概览表
export function getScoreOverview(examId, classIds) {
  return request({
    url: `/api/score/grade/overview/${examId}`,
    method: 'get',
    params: { classIds }
  }).then(handleResponse);
}

//原始分成绩及排名/api/score/grade/score-details/{examId}
export function originalScoreRanking(examId, classIds) {
  return request({
    url: `/api/score/grade/score-details/${examId}`,
    method: 'get',
    params: { classIds }
  }).then(handleResponse);
}

/**
 * 获取分数段分布
 */
export function getScoreDistribution(examId, classIds, segment) {
  return request({
    url: `/api/score/grade/score-distribution/${examId}`,
    method: 'get',
    params: {
      classIds,
      segment
    }
  })
}

//年级两份五率{examId}
export function getGradeTwopointfiverate(examId, classIds,gradeId,subjectId) {
  return request({
    url: `/api/score/grade/score-rates`,
    method: 'post',
    data: {
      examId,
      classIds,
      gradeId,
      subjectId
    }
  })
}

// 提交率/空白率对比
export function submittedcomparisonblankrates(examId, classIds) {
  return request({
    url: `/api/score/grade/student-submit/${examId}`,
    method: 'get',
    params: {
      classIds
    }
  })
}

// 学优生/学困生分布
export function orthogenicsdistribution(examId, classIds) {
  return request({
    url: `/api/score/grade/student-distribution/${examId}`,
    method: 'get',
    params: {
      classIds
    }
  })
}

//作业质量
export function homeworkqualityApi(examId, classIds) {
  return request({
    url: `/api/score/grade/homework-quality/${examId}`,
    method: 'get',
    params: {
      classIds
    }
  })
}
//试题的得分率
export function questionscorerateapi(examId, classIds) {
  return request({
    url: `/api/score/grade/question-score-rates/${examId}`,
    method: 'get',
    params: {
      classIds
    }
  })
}

//知识点得分率
export function knowledgescorerateapi(examId, classIds) {
  return request({
    url: `/api/score/grade/knowledge-score-rates/${examId}`,
    method: 'get',
    params: {
      classIds
    }
  })
}

//小题分
export function smallquestionapi(examId, classIds) {
  return request({
    url: `/api/score/grade/question-analysis/${examId}`,
    method: 'get',
    params: {
      classIds
    }
  })
}
//客观题作答分布
export function objectiveanswerapi(examId, classIds) {
  return request({
    url: `/api/score/grade/objective-answer-distribution/${examId}`,
    method: 'get',
    params: {
      classIds
    }
  })
}
//主观题作答分布
export function subjectiveanswerapi(examId, classIds) {
  return request({
    url: `/api/score/grade/subjective-answer-distribution/${examId}`,
    method: 'get',
    params: {
      classIds
    }
  })
}